package com.bkgy.controller.platecut.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bkgy.commom.model.QueryDTO;
import com.bkgy.controller.continuousSlantingHistory.utils.TimeTransUtils;
import com.bkgy.controller.platecut.entity.TbPltcmAsc;
import com.bkgy.controller.platecut.entity.TbPltcmAscRequest;
import com.bkgy.controller.platecut.mapper.TbPltcmAscMapper;
import com.bkgy.controller.platecut.service.TbPltcmAscService;
import com.bkgy.controller.tbtcmthkjudge.entity.TbTcmThkJudge;
import com.bkgy.controller.tbtcmthkjudge.entity.TbTcmThkJudgeResp;
import com.bkgy.controller.tpdol3data.dao.TPdoL3Tcm2280Dao;
import com.bkgy.controller.tpdol3data.entity.TPdoDataL3Tcm2280;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.math.BigDecimal;
import java.util.Date;

/**
* @author dell
* @description 针对表【TB_PLTCM_ASC_RESULT】的数据库操作Service实现
* @createDate 2025-05-19 18:47:32
*/
@Service
public class TbPltcmAscServiceImpl extends ServiceImpl<TbPltcmAscMapper, TbPltcmAsc>
    implements TbPltcmAscService {
    @Autowired
    private TimeTransUtils timeTransUtils;

    @Autowired
    private TbPltcmAscMapper tbPltcmAscMapper;
    @Override
    public ResultData getPlateCutData( QueryDTO<TbPltcmAscRequest> queryDTO) {
        TbPltcmAscRequest dto = queryDTO.getDto();
//        LambdaQueryWrapper<TbPltcmAsc> wrapper = new LambdaQueryWrapper<>();
//        // 构建查询条件
//        if (dto != null) {
//            wrapper.like(StringUtils.hasText(dto.getExtid()), TbPltcmAsc::getExtid, dto.getExtid());
//            wrapper.like(StringUtils.hasText(dto.getEntid()), TbPltcmAsc::getEntid, dto.getEntid());
//            wrapper.like(StringUtils.hasText(dto.getSteelGrade()), TbPltcmAsc::getSteelGrade, dto.getSteelGrade());
//            wrapper.ge(dto.getThicknessMin() != null && dto.getThicknessMin().compareTo(BigDecimal.ZERO) != 0,TbPltcmAsc::getThickness, dto.getThicknessMin());
//            wrapper.le(dto.getThicknessMax() != null && dto.getThicknessMax().compareTo(BigDecimal.ZERO) != 0,TbPltcmAsc::getThickness, dto.getThicknessMax());
//
//            wrapper.ge(dto.getWidthMin() != null && dto.getWidthMin().compareTo(BigDecimal.ZERO) != 0,TbPltcmAsc::getWidth, dto.getWidthMin());
//            wrapper.le(dto.getWidthMax() != null && dto.getWidthMin().compareTo(BigDecimal.ZERO) != 0,TbPltcmAsc::getWidth, dto.getWidthMax());
//
//            wrapper.ge(dto.getEnThicknessMin() != null && dto.getEnThicknessMin().compareTo(BigDecimal.ZERO) != 0,TbPltcmAsc::getEnThickness, dto.getEnThicknessMin());
//            wrapper.le(dto.getEnThicknessMax() != null && dto.getEnThicknessMax().compareTo(BigDecimal.ZERO) != 0,TbPltcmAsc::getEnThickness, dto.getEnThicknessMax());
//
//            wrapper.ge(timeTransUtils.timeToString(dto.getStartDate()) != null, TbPltcmAsc::getCreateTime, timeTransUtils.timeToString(dto.getStartDate()) );
//            wrapper.le(timeTransUtils.timeToString(dto.getEndDate()) != null, TbPltcmAsc::getCreateTime, timeTransUtils.timeToString(dto.getEndDate()) );
//        }
//        wrapper.orderByDesc(TbPltcmAsc::getCreateTime);
//        Page<TbPltcmAsc> page = new Page<>(queryDTO.getPage().getPageIndex(), queryDTO.getPage().getPageSize());
//        Page<TbPltcmAsc> result = page(page, wrapper);


        Page<TbTcmThkJudge> page = new Page<TbTcmThkJudge>(queryDTO.getPage().getPageIndex(), queryDTO.getPage().getPageSize());


        IPage<TbPltcmAsc> list = tbPltcmAscMapper.selectByCondition(page,dto);


        return ResultData.ResultDataSuccess(list, (int) list.getTotal());
    }


}




